package LeetcodeTest_two;
//高度检查器
public class heightChecker
{
    public static void main(String[] args)
    {
        int []height={1,1,4,2,1,3};
        int result=Solution.heightChecker(height);
        System.out.println(result);
    }
}
class Solution {
    public static int heightChecker(int[] heights)
    {
        int StandardHeight[]=new int[heights.length];
        int i,minIndex,Checker,temp;
        Checker=0;
        for (int j = 0; j < heights.length; j++)
            StandardHeight[j]=heights[j];
        for(i=0;i<heights.length-1;i++)
        {
            minIndex=i;
            for (int j = i + 1; j < heights.length; j++)
            {
                if(heights[minIndex]>heights[j])
                    minIndex=j;
            }
            temp=heights[i];
            heights[i]=heights[minIndex];
            heights[minIndex]=temp;
        }
        for (int j = 0; j < heights.length; j++)
            if(StandardHeight[j]!=heights[j])
                Checker++;
        return Checker;
    }
}